package com.cn.factory;

import com.cn.dao.BookDao;
import com.cn.dao.BookDaoImpl;
import org.springframework.beans.factory.FactoryBean;

public class BookDaoFactoryBean implements FactoryBean<BookDao> {
    private String name;
    private String gender;

    public BookDaoFactoryBean(){
        System.out.println("BookDaoFactoryBean的无参构造器");
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public String getGender() {
        return gender;
    }

    @Override
    public BookDao getObject() throws Exception {
        System.out.println("调用了getObject");
        return new BookDaoImpl(gender,name);
    }

    @Override
    public Class<?> getObjectType() {
        return BookDaoImpl.class;
    }

    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();
    }
}
